home *** CD-ROM | disk | FTP | other *** search
/ Diccionario Visual Trilingue / VISUAL.iso / SHARED.DIR / 10120_SetWindow Mode 1 a 6.ls < prev    next >
Encoding:
Text File  |  1997-07-04  |  14.9 KB  |  366 lines

  1. on SetWindow1 Fenetre, Mode
  2.   global gHighLightPos, gCurrentPos, gNbItem, gTermList, gPicList
  3.   set HighL to getAt(gHighLightPos, Fenetre)
  4.   set CurrentP to getAt(gCurrentPos, Fenetre)
  5.   set NbElement to getAt(gNbItem, Fenetre)
  6.   set ajustement to (Fenetre - 1) * 7
  7.   set Sp1 to 10 + ajustement
  8.   set Sp2 to 11 + ajustement
  9.   set Sp3 to 12 + ajustement
  10.   set Sp4 to 13 + ajustement
  11.   set Sp5 to 14 + ajustement
  12.   set Sp6 to 15 + ajustement
  13.   if Fenetre = 1 then
  14.     set Fld1 to 10096
  15.   else
  16.     if Fenetre = 2 then
  17.       set Fld1 to 10097
  18.       if NbElement > 6 then
  19.         set the visible of sprite Sp4 to 1
  20.         set the visible of sprite 45 to 0
  21.       else
  22.         set the visible of sprite Sp4 to 0
  23.         set the visible of sprite 45 to 1
  24.       end if
  25.     else
  26.       set Fld1 to 10098
  27.       if NbElement > 6 then
  28.         set the visible of sprite Sp4 to 1
  29.         set the visible of sprite 46 to 0
  30.       else
  31.         set the visible of sprite Sp4 to 0
  32.         set the visible of sprite 46 to 1
  33.       end if
  34.     end if
  35.   end if
  36.   if Mode = 1 then
  37.     set HighL to 0
  38.     set the visible of sprite Sp2 to 0
  39.     if Fenetre = 1 then
  40.       setAt(gHighLightPos, 2, 0)
  41.       set the visible of sprite (Sp2 + 7) to 0
  42.       put " " into field 10097
  43.       setAt(gNbItem, 2, 0)
  44.       setAt(gHighLightPos, 3, 0)
  45.       set the visible of sprite (Sp2 + 14) to 0
  46.       put " " into field 10098
  47.       setAt(gNbItem, 3, 0)
  48.     else
  49.       if Fenetre = 2 then
  50.         setAt(gHighLightPos, 3, 0)
  51.         set the visible of sprite (Sp2 + 7) to 0
  52.         put " " into field 10098
  53.         setAt(gNbItem, 3, 0)
  54.       else
  55.         if Fenetre = 3 then
  56.           set the visible of sprite Sp4 to 0
  57.         end if
  58.       end if
  59.     end if
  60.   else
  61.     if Mode = 2 then
  62.       if HighL < 2 then
  63.         set CurrentP to 1
  64.       else
  65.         if HighL > (NbElement - 4) then
  66.           set CurrentP to max(NbElement - 5, 1)
  67.         else
  68.           set CurrentP to HighL - 1
  69.         end if
  70.       end if
  71.       if Fenetre = 1 then
  72.         set ListResult to FindWordP(CurrentP, 1) & numToChar(13) & FindWordP(CurrentP + 1, 1) & numToChar(13) & FindWordP(CurrentP + 2, 1) & numToChar(13) & FindWordP(CurrentP + 3, 1) & numToChar(13) & FindWordP(CurrentP + 4, 1) & numToChar(13) & FindWordP(CurrentP + 5, 1)
  73.         set Search to FindWordP(HighL, 1)
  74.       else
  75.         if Fenetre = 2 then
  76.           set ListResult to EMPTY
  77.           repeat with i = 0 to min(5, NbElement - 1)
  78.             set ListResult to ListResult & getAt(gTermList, CurrentP + i) & numToChar(13)
  79.           end repeat
  80.           delete char -30003 of ListResult
  81.           set Search to getAt(gTermList, HighL)
  82.         else
  83.           if Fenetre = 3 then
  84.             set ListResult to EMPTY
  85.             repeat with i = 0 to min(5, NbElement - 1)
  86.               set ListResult to ListResult & getAt(gPicList, CurrentP + i) & numToChar(13)
  87.             end repeat
  88.             delete char -30003 of ListResult
  89.             set Search to getAt(gPicList, HighL)
  90.           end if
  91.         end if
  92.       end if
  93.       if (line 1 of ListResult = Search) and (CurrentP = 1) then
  94.         set HighL to CurrentP
  95.       else
  96.         if (CurrentP + 5) = NbElement then
  97.           if line 2 of ListResult >= Search then
  98.             set HighL to CurrentP + 1
  99.           else
  100.             if line 3 of ListResult >= Search then
  101.               set HighL to CurrentP + 2
  102.             else
  103.               if line 4 of ListResult >= Search then
  104.                 set HighL to CurrentP + 3
  105.               else
  106.                 if line 5 of ListResult >= Search then
  107.                   set HighL to CurrentP + 4
  108.                 else
  109.                   if line 6 of ListResult >= Search then
  110.                     set HighL to CurrentP + 5
  111.                   end if
  112.                 end if
  113.               end if
  114.             end if
  115.           end if
  116.         else
  117.           set HighL to CurrentP + 1
  118.         end if
  119.       end if
  120.       put ListResult into field Fld1
  121.       UpdateCursor(Fenetre, CurrentP)
  122.       set the locV of sprite Sp2 to ((HighL - CurrentP) * 12) + SpriteTop(Sp1) + 1
  123.       set the visible of sprite Sp2 to 1
  124.     else
  125.       if Mode = 3 then
  126.         if Fenetre = 1 then
  127.           set ListResult to FindWordP(CurrentP, 1) & numToChar(13) & FindWordP(CurrentP + 1, 1) & numToChar(13) & FindWordP(CurrentP + 2, 1) & numToChar(13) & FindWordP(CurrentP + 3, 1) & numToChar(13) & FindWordP(CurrentP + 4, 1) & numToChar(13) & FindWordP(CurrentP + 5, 1)
  128.         else
  129.           if Fenetre = 2 then
  130.             set ListResult to EMPTY
  131.             repeat with i = 0 to min(NbElement - 1, 5)
  132.               set ListResult to ListResult & getAt(gTermList, CurrentP + i) & numToChar(13)
  133.             end repeat
  134.             delete char -30003 of ListResult
  135.           else
  136.             set ListResult to EMPTY
  137.             repeat with i = 0 to min(NbElement - 1, 5)
  138.               set ListResult to ListResult & getAt(gPicList, CurrentP + i) & numToChar(13)
  139.             end repeat
  140.             delete char -30003 of ListResult
  141.           end if
  142.         end if
  143.         put ListResult into field Fld1
  144.         set LineNum to HighL - CurrentP + 1
  145.         if (HighL <> 0) and (LineNum <= 6) and (LineNum > 0) then
  146.           set the locV of sprite Sp2 to ((LineNum - 1) * 12) + SpriteTop(Sp1) + 1
  147.           set the visible of sprite Sp2 to 1
  148.         else
  149.           if the visible of sprite Sp2 = 1 then
  150.             set the visible of sprite Sp2 to 0
  151.           end if
  152.         end if
  153.         UpdateCursor(Fenetre, CurrentP)
  154.       else
  155.         if Mode = 4 then
  156.           set LineNum to HighL - CurrentP + 1
  157.           if not ((LineNum <= 6) and (LineNum > 0)) or (HighL = 0) then
  158.             if HighL = 0 then
  159.               set HighL to CurrentP
  160.               if Fenetre = 1 then
  161.                 FindTerms(HighL)
  162.                 setAt(gCurrentPos, 2, 1)
  163.                 setAt(gHighLightPos, 2, 0)
  164.                 SetWindow1(2, 3)
  165.               else
  166.                 if Fenetre = 2 then
  167.                   FindPics(HighL)
  168.                   setAt(gCurrentPos, 3, 1)
  169.                   setAt(gHighLightPos, 3, 0)
  170.                   SetWindow1(3, 3)
  171.                 end if
  172.               end if
  173.             else
  174.               if HighL > (NbElement - 5) then
  175.                 set CurrentP to max(NbElement - 5, 1)
  176.               else
  177.                 set CurrentP to HighL
  178.               end if
  179.             end if
  180.             if Fenetre = 1 then
  181.               set ListResult to FindWordP(CurrentP, 1) & numToChar(13) & FindWordP(CurrentP + 1, 1) & numToChar(13) & FindWordP(CurrentP + 2, 1) & numToChar(13) & FindWordP(CurrentP + 3, 1) & numToChar(13) & FindWordP(CurrentP + 4, 1) & numToChar(13) & FindWordP(CurrentP + 5, 1)
  182.               set the text of cast 10095 to FindWordP(HighL, 0)
  183.             else
  184.               if Fenetre = 2 then
  185.                 set ListResult to EMPTY
  186.                 repeat with i = 0 to min(5, NbElement - 1)
  187.                   set ListResult to ListResult & getAt(gTermList, CurrentP + i) & numToChar(13)
  188.                 end repeat
  189.                 delete char -30003 of ListResult
  190.               else
  191.                 set ListResult to EMPTY
  192.                 repeat with i = 0 to min(5, NbElement - 1)
  193.                   set ListResult to ListResult & getAt(gPicList, CurrentP + i) & numToChar(13)
  194.                 end repeat
  195.                 delete char -30003 of ListResult
  196.               end if
  197.             end if
  198.             put ListResult into field Fld1
  199.             UpdateCursor(Fenetre, CurrentP)
  200.             set the locV of sprite Sp2 to ((HighL - CurrentP) * 12) + SpriteTop(Sp1) + 1
  201.             if the visible of sprite Sp2 = 0 then
  202.               set the visible of sprite Sp2 to 1
  203.             end if
  204.           end if
  205.         else
  206.           if (Mode = 5) and not ((HighL = 1) and (CurrentP = 1)) then
  207.             if HighL = 0 then
  208.               set HighL to CurrentP
  209.             else
  210.               set LineNum to HighL - CurrentP + 1
  211.               if (LineNum <= min(6, NbElement)) and (LineNum > 1) then
  212.                 set HighL to HighL - 1
  213.               else
  214.                 if LineNum = 1 then
  215.                   if Fenetre = 1 then
  216.                     set ListResult to the text of field Fld1
  217.                     delete line 6 of ListResult
  218.                     set CurrentP to CurrentP - 1
  219.                     set TempWord to FindWordP(CurrentP, 1) & numToChar(13)
  220.                     put TempWord before line 1 of ListResult
  221.                   else
  222.                     if Fenetre = 2 then
  223.                       set ListResult to the text of field Fld1
  224.                       delete line 6 of ListResult
  225.                       set CurrentP to CurrentP - 1
  226.                       set TempWord to getAt(gTermList, CurrentP) & numToChar(13)
  227.                       put TempWord before line 1 of ListResult
  228.                     else
  229.                       set ListResult to the text of field Fld1
  230.                       delete line 6 of ListResult
  231.                       set CurrentP to CurrentP - 1
  232.                       set TempWord to getAt(gPicList, CurrentP) & numToChar(13)
  233.                       put TempWord before line 1 of ListResult
  234.                     end if
  235.                   end if
  236.                 else
  237.                   if HighL = 1 then
  238.                     set CurrentP to 1
  239.                     set HighL to 2
  240.                   else
  241.                     if HighL > (NbElement - 5) then
  242.                       set CurrentP to NbElement - 5
  243.                     else
  244.                       set CurrentP to HighL - 1
  245.                     end if
  246.                   end if
  247.                   if Fenetre = 1 then
  248.                     set ListResult to FindWordP(CurrentP, 1) & numToChar(13) & FindWordP(CurrentP + 1, 1) & numToChar(13) & FindWordP(CurrentP + 2, 1) & numToChar(13) & FindWordP(CurrentP + 3, 1) & numToChar(13) & FindWordP(CurrentP + 4, 1) & numToChar(13) & FindWordP(CurrentP + 5, 1)
  249.                   else
  250.                     if Fenetre = 2 then
  251.                       set ListResult to EMPTY
  252.                       repeat with i = 0 to 5
  253.                         set ListResult to ListResult & getAt(gTermList, CurrentP + i) & numToChar(13)
  254.                       end repeat
  255.                       delete char -30003 of ListResult
  256.                     else
  257.                       set ListResult to EMPTY
  258.                       repeat with i = 0 to 5
  259.                         set ListResult to ListResult & getAt(gPicList, CurrentP + i) & numToChar(13)
  260.                       end repeat
  261.                       delete char -30003 of ListResult
  262.                     end if
  263.                   end if
  264.                 end if
  265.                 set HighL to max(HighL - 1, 1)
  266.                 put ListResult into field Fld1
  267.                 UpdateCursor(Fenetre, CurrentP)
  268.               end if
  269.             end if
  270.             set the locV of sprite Sp2 to ((HighL - CurrentP) * 12) + SpriteTop(Sp1) + 1
  271.             if the visible of sprite Sp2 = 0 then
  272.               set the visible of sprite Sp2 to 1
  273.             end if
  274.             if Fenetre = 1 then
  275.               set ListResult to the text of field Fld1
  276.               put FindWordP(HighL, 0) into field 10095
  277.               set the selEnd to the length of line 1 of the text of cast 10095
  278.               set the selStart to the selEnd
  279.               set the foreColor of cast 10095 to 14
  280.             end if
  281.           else
  282.             if (Mode = 6) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  283.               if HighL = 0 then
  284.                 set HighL to CurrentP
  285.               else
  286.                 set LineNum to HighL - CurrentP + 1
  287.                 if (LineNum <= min(NbElement - 1, 5)) and (LineNum > 0) then
  288.                   set HighL to HighL + 1
  289.                 else
  290.                   if LineNum = 6 then
  291.                     if Fenetre = 1 then
  292.                       set ListResult to the text of field Fld1
  293.                       delete line 1 of ListResult
  294.                       set CurrentP to CurrentP + 1
  295.                       set TempWord to numToChar(13) & FindWordP(CurrentP + 5, 1)
  296.                       put TempWord after ListResult
  297.                     else
  298.                       if Fenetre = 2 then
  299.                         set ListResult to the text of field Fld1
  300.                         delete line 1 of ListResult
  301.                         set CurrentP to CurrentP + 1
  302.                         set TempWord to numToChar(13) & getAt(gTermList, CurrentP + 5)
  303.                         put TempWord after ListResult
  304.                       else
  305.                         set ListResult to the text of field Fld1
  306.                         delete line 1 of ListResult
  307.                         set CurrentP to CurrentP + 1
  308.                         set TempWord to numToChar(13) & getAt(gPicList, CurrentP + 5)
  309.                         put TempWord after ListResult
  310.                       end if
  311.                     end if
  312.                   else
  313.                     if HighL < 6 then
  314.                       set CurrentP to 1
  315.                     else
  316.                       if HighL > (NbElement - 5) then
  317.                         set CurrentP to NbElement - 5
  318.                       else
  319.                         set CurrentP to HighL - 4
  320.                       end if
  321.                     end if
  322.                     if Fenetre = 1 then
  323.                       set ListResult to FindWordP(CurrentP, 1) & numToChar(13) & FindWordP(CurrentP + 1, 1) & numToChar(13) & FindWordP(CurrentP + 2, 1) & numToChar(13) & FindWordP(CurrentP + 3, 1) & numToChar(13) & FindWordP(CurrentP + 4, 1) & numToChar(13) & FindWordP(CurrentP + 5, 1)
  324.                     else
  325.                       if Fenetre = 2 then
  326.                         set ListResult to EMPTY
  327.                         repeat with i = 0 to 5
  328.                           set ListResult to ListResult & getAt(gTermList, CurrentP + i) & numToChar(13)
  329.                         end repeat
  330.                         delete char -30003 of ListResult
  331.                       else
  332.                         set ListResult to EMPTY
  333.                         repeat with i = 0 to 5
  334.                           set ListResult to ListResult & getAt(gPicList, CurrentP + i) & numToChar(13)
  335.                         end repeat
  336.                         delete char -30003 of ListResult
  337.                       end if
  338.                     end if
  339.                   end if
  340.                   set HighL to min(HighL + 1, NbElement)
  341.                   put ListResult into field Fld1
  342.                   UpdateCursor(Fenetre, CurrentP)
  343.                 end if
  344.               end if
  345.               set the locV of sprite Sp2 to ((HighL - CurrentP) * 12) + SpriteTop(Sp1) + 1
  346.               if the visible of sprite Sp2 = 0 then
  347.                 set the visible of sprite Sp2 to 1
  348.               end if
  349.               if Fenetre = 1 then
  350.                 set ListResult to the text of field Fld1
  351.                 put FindWordP(HighL, 0) into field 10095
  352.                 set the selEnd to the length of line 1 of the text of cast 10095
  353.                 set the selStart to the selEnd
  354.                 set the foreColor of cast 10095 to 14
  355.               end if
  356.             end if
  357.           end if
  358.         end if
  359.       end if
  360.     end if
  361.   end if
  362.   setAt(gCurrentPos, Fenetre, CurrentP)
  363.   setAt(gHighLightPos, Fenetre, HighL)
  364.   updateStage()
  365. end
  366.